// pages/businessFlow/components/billSaleList.js

const curConfig = require("../config/config");

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    list: {
      type: Array,
      value: []
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    activeName: -1,
    steps: [],
    stepActive: -1,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onChange(event) {
      const _this = this;
      let gen_list = [], active_index = 0;
      if(!!_this.data.list && !!_this.data.list[event.detail]){
        const {
          genList,
          activeIndex
        } = curConfig.genStep(_this.data.list[event.detail] || {});
        gen_list = genList;
        active_index = activeIndex;
      }
      
      _this.setData({
        activeName: event.detail,
        steps: gen_list,
        stepActive: active_index
      });
    },
  }
})
